package com.crazyauntzhang.easyshopbackend.service;

import com.crazyauntzhang.easyshopbackend.dao.UserDao;
import com.crazyauntzhang.easyshopbackend.domain.User;
import com.crazyauntzhang.easyshopbackend.util.Token;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginService {

	private final UserDao userDao;

	@Autowired
	public LoginService(UserDao userDao) {
		this.userDao = userDao;
	}

	/**
	 * 登录
	 *
	 * @param userID   用户ID
	 * @param password 密码
	 * @return 查询到的登录用户
	 */
	public User login(String userID, String password) {
		return userDao.selectLoginUser(userID, password);
	}

	@Deprecated
	public Boolean loginCheck(String token) {
		return Token.verifyToken(token);
	}

}
